<!DOCTYPE html>
<html lang="en">

<head>
    <!-- BEGIN META -->
    {include file="public/meta"}
    <!-- END META -->

    <!-- BEGIN STYLESHEET-->
    {include file="public/css"}
    <!-- END STYLESHEET-->

    <title>
        {$current_menu['title']} - {$yun_config.title}
    </title>
</head>

<body>
<!-- BEGIN SECTION -->
<section id="container">
    <!-- BEGIN HEADER -->
    {include file="public/header"}
    <!-- END HEADER -->
    <!-- BEGIN SIDEBAR -->
    {include file="public/sidebar"}
    <!-- END SIDEBAR -->
    <!-- BEGIN MAIN CONTENT -->
    <section id="main-content">
        <!-- BEGIN WRAPPER  -->
        <section class="wrapper z-index-1">
            <!-- TOP MENU ROW  -->
            {include file="public/top_menu"}
            <!-- TOP MENU ROW  -->

            <!-- BEGIN ROW  -->
            <div class="row">
                <div class="col-lg-12">
                    <section class="panel">
                        <header class="panel-heading">
                            <span class="label label-primary">{$current_menu.title}</span>
                            <span class="tools pull-right"></span>
                        </header>
                        <div class="panel-body">
                            <!-- BTN GROUP-->
                            <div class="clearfix">
                                <div class="btn-group pull-left">
                                    <a href="{:url('add')}" class="btn btn-success green">
                                        <i class="fa fa-plus"></i> 新增菜单
                                    </a>
                                </div>
                            </div>
                            <!-- END BTN GROUP -->
                            <table class="table table-striped table-advance table-hover">
                                <thead>
                                <tr>
                                    <th class="text-center"><i class="fa fa-list"></i> ID </th>
                                    <th class="text-left"><i class="fa fa-sitemap"></i> 菜单名称 </th>
                                    <th class="text-center hidden-phone"><i class="fa fa-paperclip"></i> Controller/Action </th>
                                    <th class="text-center hidden-phone"><i class="fa fa-laptop"></i> ICON </th>
                                    <th class="text-center hidden-phone"><i class="fa fa-sort-numeric-asc"></i> 排序 </th>
                                    <th class="text-center hidden-phone"><i class="fa fa-ban"></i> 状态 </th>
                                    <th class="text-center hidden-phone"><i class="fa fa-clock-o"></i> 创建时间 </th>
                                    <th class="text-center"><i class="fa fa-calendar-o"></i> 操作 </th>
                                </tr>
                                </thead>
                                <tbody>
                                {volist name="menu_list" id="item"}
                                <tr>
                                    <td class="text-center">{$item.id}</td>
                                    <td class="text-left">{$item.title}</td>
                                    <td class="text-center hidden-phone">{$item.rule_url}</td>
                                    <td class="text-center hidden-phone"><li class="{$item.icon}"></li></td>
                                    <td class="text-center hidden-phone">{$item.sort}</td>
                                    <td class="text-center hidden-phone">{if condition="$item['is_link'] eq 1"}显示{else /}隐藏{/if}</td>
                                    <td class="text-center hidden-phone">{$item.create_time}</td>
                                    <td class="text-center">
                                        {if condition="$item.id neq 1"}
                                        <a href="{:url('edit',['id'=>$item.id])}" class="btn btn-primary btn-xs" title="修改">
                                            <li class="fa fa-pencil"></li>
                                        </a>
                                        <a val="{:url('del',['id'=>$item.id])}" class="btn btn-danger btn-xs del" title="删除">
                                            <li class="fa fa-trash-o"></li>
                                        </a>
                                        {else /}--
                                        {/if}
                                    </td>
                                </tr>
                                {if condition="!empty($item['children'])"}
                                {volist name="$item['children']" id="item_son"}
                                <tr>
                                    <td class="text-center">{$item_son.id}</td>
                                    <td class="text-left">┗━{$item_son.title}</td>
                                    <td class="text-center hidden-phone">{$item_son.rule_url}</td>
                                    <td class="text-center hidden-phone"><li class="{$item_son.icon}"></li></td>
                                    <td class="text-center hidden-phone">{$item_son.sort}</td>
                                    <td class="text-center hidden-phone">{if condition="$item_son['is_link'] eq 1"}显示{else /}隐藏{/if}</td>
                                    <td class="text-center hidden-phone">{$item_son.create_time}</td>
                                    <td class="text-center">
                                        <a href="{:url('admin/Menu/edit',['id'=>$item_son.id])}" class="btn btn-primary btn-xs" title="修改">
                                            <li class="fa fa-pencil"></li>
                                        </a>
                                        <a val="{:url('admin/Menu/del',['id'=>$item_son.id])}" class="btn btn-danger btn-xs del" title="删除">
                                            <li class="fa fa-trash-o"></li>
                                        </a>
                                    </td>
                                </tr>
                                {if condition="!empty($item_son['children'])"}
                                {volist name="$item_son['children']" id="item_grandson"}
                                <tr>
                                    <td class="text-center">{$item_grandson.id}</td>
                                    <td class="text-left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;┗━
                                        {$item_grandson.title}
                                    </td>
                                    <td class="text-center hidden-phone">{$item_grandson.rule_url}</td>
                                    <td class="text-center hidden-phone">
                                        <li class="{$item_grandson.icon}"></li>
                                    </td>
                                    <td class="text-center hidden-phone">{$item_grandson.sort}</td>
                                    <td class="text-center hidden-phone">{if condition="$item_grandson['is_link'] eq 1"}显示{else /}隐藏{/if}</td>
                                    <td class="text-center hidden-phone">{$item_grandson.create_time}</td>
                                    <td class="text-center">
                                        <a href="{:url('admin/Menu/edit',['id'=>$item_grandson.id])}" class="btn btn-primary btn-xs" title="修改">
                                            <li class="fa fa-pencil"></li>
                                        </a>
                                        <a val="{:url('admin/Menu/del',['id'=>$item_grandson.id])}" class="btn btn-danger btn-xs del" title="删除">
                                            <li class="fa fa-trash-o"></li>
                                        </a>
                                    </td>
                                </tr>
                                {/volist}
                                {/if}
                                {/volist}
                                {/if}
                                {/volist}
                                </tbody>
                            </table>
                        </div>
                    </section>
                </div>
            </div>
            <!-- END ROW  -->
        </section>
        <!-- END WRAPPER  -->
    </section>
    <!-- END MAIN CONTENT -->
    <!-- BEGIN FOOTER -->
    {include file="public/footer"}
    <!-- END FOOTER -->
</section>
<!-- END SECTION -->
<!-- BEGIN JS -->
{include file="public/js"}
<!-- INLINE JS RELATED TO THIS PAGE -->
<script type="text/javascript">
    $(function() {
        $(".del").click(function() {
            var url = $(this).attr('val');
            layer.confirm('确定要删除此菜单吗？', {
                btn: ['确定', '取消'] //按钮
            }, function() {
                window.location.href = url;
            }, function() {});
        });
    });
</script>
<!-- END JS -->
</body>

</html>